package routers

import (
	"bubble/controller"
	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine {
	r := gin.Default()
	r.Static("static", "static")
	r.LoadHTMLGlob("templates/*")

	r.GET("", controller.IndexHandler)

	g := r.Group("v1")
	{
		g.PUT("/todo/:id", controller.UpdateTodoHandler)
		g.POST("/todo", controller.AddTodoHandler)
		g.GET("/todo", controller.GetTodoHandler)
		g.DELETE("/todo/:id", controller.DeleteToHandler)
	}
	return r
}